home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / thinkref / archive / THINKPascalUH2.1.sea / THINKPas Univ Hdr 2.1 / Interfaces / MacTCP.p < prev    next >
Text File  |  1995-09-12  |  20KB  |  770 lines

  1. { Converted with MPW2TPas Tuesday, September 12, 1995 7:33:57 PM }
  2. {
  3.      File:        MacTCP.p
  4.  
  5.      Contains:    TCP Manager Interfaces.
  6.  
  7.      Version:    Technology:    MacTCP 2.0.6
  8.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  9.  
  10.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  11.                  All rights reserved.
  12.  
  13.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  14.                  stack.  Include the file and version information (from above)
  15.                  in the problem description and send to:
  16.                      Internet:    apple.bugs@applelink.apple.com
  17.                      AppleLink:    APPLE.BUGS
  18.  
  19. }
  20.  
  21.  UNIT MacTCP;
  22.  INTERFACE
  23.  
  24.  
  25. {$IFC UNDEFINED __MACTCP__}
  26. {$SETC __MACTCP__ := 1}
  27.  
  28.   USES
  29.    ConditionalMacros, Types, AppleTalk;
  30.  
  31. { $PUSH}
  32. { $ALIGN MAC68K}
  33. { $LibExport+}
  34. {
  35. Developer Notes:
  36.         0. This MacTCP header replaces what used to be defined in the following header files
  37.             MacTCPCommonTypes.h
  38.             GetMyIPAddr.h
  39.             MiscIPPB.h
  40.             TCPPB.h
  41.             UDPPB.h 
  42.             
  43.             When the various control calls are made to the ip driver, you must set up a 
  44.             NewRoutineDescriptor for every non-nil completion routine and/or notifyProc parameter.  
  45.             Otherwise, the 68K driver code, will not correctly call your routine.
  46.         1. For ipctlGetAddr Control calls, use NewGetIPIOCompletionProc
  47.             to set up a GetIPIOCompletionUPP universal procptr to pass as
  48.             the ioCompletion parameter.
  49.         2. For the ipctlEchoICMP and ipctlLAPStats Control calls, use 
  50.             NewIPIOCompletion to set up a IPIOCompletionUPP universal procptr
  51.             to pass in the ioCompletion field of the parameter block.
  52.         3. For TCPCreatePB Control calls, use NewTCPNotifyProc to set up a
  53.             TCPNotifyUPP universal procptr to pass in the notifyProc field
  54.             of the parameter block
  55.         4. For all of the TCP Control calls using the TCPiopb parameter block,
  56.             use NewTCPIOCompletionProc to set up a TCPIOCompletionUPP
  57.             universal procptr to pass in the ioCompletion field of the paramter
  58.             block.
  59.         5. For UDBCreatePB Control calls, use NewUDPNotifyProc to set up a
  60.             UDPNotifyUPP universal procptr to pass in the notifyProc field
  61.             of the parameter block
  62.         6. For all of the UDP Control calls using the UDPiopb parameter block,
  63.             use NewUDPIOCompletionProc to set up a UDPIOCompletionUPP
  64.             universal procptr to pass in the ioCompletion field of the paramter
  65.             block.
  66.         7. For all calls implementing a notifyProc or ioCompletion routine
  67.             which was set up using a NewTCPRoutineProc call, do not call
  68.             DisposeRoutineSDescriptor on the universal procptr until
  69.             after the completion or notify proc has completed.
  70. }
  71. { MacTCP return Codes in the range -23000 through -23049 }
  72.  
  73. CONST
  74.     inProgress                    = 1;                            { I/O in progress }
  75.     ipBadLapErr                    = -23000;                        { bad network configuration }
  76.     ipBadCnfgErr                = -23001;                        { bad IP configuration error }
  77.     ipNoCnfgErr                    = -23002;                        { missing IP or LAP configuration error }
  78.     ipLoadErr                    = -23003;                        { error in MacTCP load }
  79.     ipBadAddr                    = -23004;                        { error in getting address }
  80.     connectionClosing            = -23005;                        { connection is closing }
  81.     invalidLength                = -23006;
  82.     connectionExists            = -23007;                        { request conflicts with existing connection }
  83.     connectionDoesntExist        = -23008;                        { connection does not exist }
  84.     insufficientResources        = -23009;                        { insufficient resources to perform request }
  85.     invalidStreamPtr            = -23010;
  86.     streamAlreadyOpen            = -23011;
  87.     connectionTerminated        = -23012;
  88.     invalidBufPtr                = -23013;
  89.     invalidRDS                    = -23014;
  90.     invalidWDS                    = -23014;
  91.     openFailed                    = -23015;
  92.     commandTimeout                = -23016;
  93.     duplicateSocket                = -23017;
  94.  
  95. { Error codes from internal IP functions }
  96.     ipDontFragErr                = -23032;                        { Packet too large to send w/o fragmenting }
  97.     ipDestDeadErr                = -23033;                        { destination not responding }
  98.     icmpEchoTimeoutErr            = -23035;                        { ICMP echo timed-out }
  99.     ipNoFragMemErr                = -23036;                        { no memory to send fragmented pkt }
  100.     ipRouteErr                    = -23037;                        { can't route packet off-net }
  101.     nameSyntaxErr                = -23041;
  102.     cacheFault                    = -23042;
  103.     noResultProc                = -23043;
  104.     noNameServer                = -23044;
  105.     authNameErr                    = -23045;
  106.     noAnsErr                    = -23046;
  107.     dnrErr                        = -23047;
  108.     outOfMemory                    = -23048;
  109.  
  110.     BYTES_16WORD                = 2;                            { bytes per = 16, bit ip word }
  111.     BYTES_32WORD                = 4;                            { bytes per = 32, bit ip word }
  112.     BYTES_64WORD                = 8;                            { bytes per = 64, bit ip word }
  113.  
  114. { 8-bit quantity }
  115.     
  116. TYPE
  117.     b_8 = UInt8;
  118.  
  119. { 16-bit quantity }
  120.     b_16 = UInt16;
  121.  
  122. { 32-bit quantity }
  123.     b_32 = UInt32;
  124.  
  125. { IP address is 32-bits }
  126.     ip_addr = b_32;
  127.  
  128.     ip_addrbytes = RECORD
  129.         CASE INTEGER OF
  130.         0: (
  131.             addr:                        b_32;
  132.            );
  133.         1: (
  134.             byte:                        PACKED ARRAY [0..3] OF SInt8; { UInt8 }
  135.            );
  136.  
  137.     END;
  138.  
  139.     wdsEntry = RECORD
  140.         length:                    INTEGER;                                { length of buffer }
  141.         ptr:                    Ptr;                                    { pointer to buffer }
  142.     END;
  143.  
  144.     rdsEntry = RECORD
  145.         length:                    INTEGER;                                { length of buffer }
  146.         ptr:                    Ptr;                                    { pointer to buffer }
  147.     END;
  148.  
  149.     BufferPtr = LONGINT;
  150.  
  151.     StreamPtr = LONGINT;
  152.  
  153.  
  154. CONST
  155.     netUnreach                    = 0;
  156.     hostUnreach                    = 1;
  157.     protocolUnreach                = 2;
  158.     portUnreach                    = 3;
  159.     fragReqd                    = 4;
  160.     sourceRouteFailed            = 5;
  161.     timeExceeded                = 6;
  162.     parmProblem                    = 7;
  163.     missingOption                = 8;
  164.     lastICMPMsgType                = 32767;
  165.  
  166.     
  167. TYPE
  168.     ICMPMsgType = INTEGER;
  169.  
  170.     ip_port = b_16;
  171.  
  172.     ICMPReport = RECORD
  173.         streamPtr:                StreamPtr;
  174.         localHost:                ip_addr;
  175.         localPort:                ip_port;
  176.         remoteHost:                ip_addr;
  177.         remotePort:                ip_port;
  178.         reportType:                INTEGER;
  179.         optionalAddlInfo:        INTEGER;
  180.         optionalAddlInfoPtr:    LONGINT;
  181.     END;
  182.  
  183. { csCode to get our IP address }
  184.  
  185. CONST
  186.     ipctlGetAddr                = 15;
  187.  
  188. TYPE
  189.     GetIPIOCompletionProcPtr = ProcPtr;  { PROCEDURE GetIPIOCompletion(VAR iopb: GetAddrParamBlock); }
  190.     GetIPIOCompletionUPP = UniversalProcPtr;
  191.  
  192.     GetAddrParamBlock = RECORD
  193.         qLink:                    ^QElem;
  194.         qType:                    INTEGER;
  195.         ioTrap:                    INTEGER;
  196.         ioCmdAddr:                Ptr;
  197.         ioCompletion:            GetIPIOCompletionUPP;
  198.         ioResult:                OSErr;
  199.         ioNamePtr:                StringPtr;
  200.         ioVRefNum:                INTEGER;
  201.         ioCRefNum:                INTEGER;
  202.         csCode:                    INTEGER;                                { standard I/O header }
  203.         ourAddress:                ip_addr;                                { our IP address }
  204.         ourNetMask:                LONGINT;                                { our IP net mask }
  205.     END;
  206.  
  207. { control codes }
  208.  
  209. CONST
  210.     ipctlEchoICMP                = 17;                            { send icmp echo }
  211.     ipctlLAPStats                = 19;                            { get lap stats }
  212.  
  213. TYPE
  214.     IPIOCompletionProcPtr = ProcPtr;  { PROCEDURE IPIOCompletion(VAR iopb: ICMPParamBlock); }
  215.     IPIOCompletionUPP = UniversalProcPtr;
  216.  
  217.     ICMPParamBlock = RECORD
  218.         qLink:                    ^QElem;
  219.         qType:                    INTEGER;
  220.         ioTrap:                    INTEGER;
  221.         ioCmdAddr:                Ptr;
  222.         ioCompletion:            IPIOCompletionUPP;
  223.         ioResult:                OSErr;
  224.         ioNamePtr:                StringPtr;
  225.         ioVRefNum:                INTEGER;
  226.         ioCRefNum:                INTEGER;
  227.         csCode:                    INTEGER;                                { standard I/O header }
  228.         params:                    ARRAY [0..10] OF INTEGER;
  229.         icmpEchoInfo:            RECORD
  230.                 echoRequestOut:                    LONGINT;                        { time in ticks of when the echo request went out }
  231.                 echoReplyIn:                    LONGINT;                        { time in ticks of when the reply was received }
  232.                 echoedData:                        rdsEntry;                        { data received in responce }
  233.                 options:                        Ptr;
  234.                 userDataPtr:                    LONGINT;
  235.             END;
  236.  
  237.  
  238.     END;
  239.  
  240.     ICMPEchoNotifyProcPtr = ProcPtr;  { PROCEDURE ICMPEchoNotify(VAR iopb: ICMPParamBlock); }
  241.     ICMPEchoNotifyUPP = UniversalProcPtr;
  242.  
  243.     IPParamBlock = RECORD
  244.         qLink:                    ^QElem;
  245.         qType:                    INTEGER;
  246.         ioTrap:                    INTEGER;
  247.         ioCmdAddr:                Ptr;
  248.         ioCompletion:            IPIOCompletionUPP;
  249.         ioResult:                OSErr;
  250.         ioNamePtr:                StringPtr;
  251.         ioVRefNum:                INTEGER;
  252.         ioCRefNum:                INTEGER;
  253.         csCode:                    INTEGER;                                { standard I/O header }
  254.         CASE INTEGER OF
  255.         0: (
  256.             dest:                        ip_addr;                            { echo to IP address }
  257.             data:                        wdsEntry;
  258.             timeout:                    INTEGER;
  259.             options:                    Ptr;
  260.             optLength:                    INTEGER;
  261.             icmpCompletion:                ICMPEchoNotifyUPP;
  262.             userDataPtr:                LONGINT;
  263.            );
  264.         1: (
  265.             lapStatsPtr:                ^LAPStats;
  266.            );
  267.  
  268.     END;
  269.  
  270.     LAPStatsAddrXlation = RECORD
  271.         CASE INTEGER OF
  272.         0: (
  273.             arp_table:                    ^arp_entry;
  274.            );
  275.         1: (
  276.             nbp_table:                    ^nbp_entry;
  277.            );
  278.     END;
  279.  
  280.     LAPStats = RECORD
  281.         ifType:                    INTEGER;
  282.         ifString:                ^CHAR;
  283.         ifMaxMTU:                INTEGER;
  284.         ifSpeed:                LONGINT;
  285.         ifPhyAddrLength:        INTEGER;
  286.         ifPhysicalAddress:        ^CHAR;
  287.         AddrXlation:            LAPStatsAddrXlation;
  288.         slotNumber:                INTEGER;
  289.     END;
  290.  
  291.     nbp_entry = RECORD
  292.         ip_address:                ip_addr;                                { IP address }
  293.         at_address:                AddrBlock;                                { matching AppleTalk address }
  294.         gateway:                BOOLEAN;                                { TRUE if entry for a gateway }
  295.         valid:                    BOOLEAN;                                { TRUE if LAP address is valid }
  296.         probing:                BOOLEAN;                                { TRUE if NBP lookup pending }
  297.         afiller:                SInt8;                                    { Filler for proper byte alignment     }
  298.         age:                    LONGINT;                                { ticks since cache entry verified }
  299.         access:                    LONGINT;                                { ticks since last access }
  300.         filler:                    ARRAY [0..115] OF SInt8;                { for internal use only !!! }
  301.     END;
  302.  
  303.     Enet_addr = RECORD
  304.         en_hi:                    b_16;
  305.         en_lo:                    b_32;
  306.     END;
  307.  
  308.     arp_entry = RECORD
  309.         age:                    INTEGER;                                { cache aging field }
  310.         protocol:                b_16;                                    { Protocol type }
  311.         ip_address:                ip_addr;                                { IP address }
  312.         en_address:                Enet_addr;                                { matching Ethernet address }
  313.     END;
  314.  
  315. { number of ARP table entries }
  316.  
  317. CONST
  318.     ARP_TABLE_SIZE                = 20;
  319.  
  320.     NBP_TABLE_SIZE                = 20;                            { number of NBP table entries }
  321.     NBP_MAX_NAME_SIZE            = 28;
  322.  
  323. { Command codes }
  324.     TCPCreate                    = 30;
  325.     TCPPassiveOpen                = 31;
  326.     TCPActiveOpen                = 32;
  327.     TCPSend                        = 34;
  328.     TCPNoCopyRcv                = 35;
  329.     TCPRcvBfrReturn                = 36;
  330.     TCPRcv                        = 37;
  331.     TCPClose                    = 38;
  332.     TCPAbort                    = 39;
  333.     TCPStatus                    = 40;
  334.     TCPExtendedStat                = 41;
  335.     TCPRelease                    = 42;
  336.     TCPGlobalInfo                = 43;
  337.     TCPCtlMax                    = 49;
  338.  
  339.     TCPClosing                    = 1;
  340.     TCPULPTimeout                = 2;
  341.     TCPTerminate                = 3;
  342.     TCPDataArrival                = 4;
  343.     TCPUrgent                    = 5;
  344.     TCPICMPReceived                = 6;
  345.     lastEvent                    = 32767;
  346.  
  347.     
  348. TYPE
  349.     TCPEventCode = INTEGER;
  350.  
  351.  
  352. CONST
  353.     TCPRemoteAbort                = 2;
  354.     TCPNetworkFailure            = 3;
  355.     TCPSecPrecMismatch            = 4;
  356.     TCPULPTimeoutTerminate        = 5;
  357.     TCPULPAbort                    = 6;
  358.     TCPULPClose                    = 7;
  359.     TCPServiceError                = 8;
  360.     lastReason                    = 32767;
  361.  
  362.     
  363. TYPE
  364.     TCPTerminationReason = INTEGER;
  365.  
  366.     TCPNotifyProcPtr = ProcPtr;  { PROCEDURE TCPNotify(tcpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; terminReason: INTEGER; VAR icmpMsg: ICMPReport); }
  367.     TCPNotifyUPP = UniversalProcPtr;
  368.  
  369.     tcp_port = INTEGER;
  370.  
  371. { ValidityFlags }
  372.  
  373. CONST
  374.     timeoutValue                = $80;
  375.     timeoutAction                = $40;
  376.     typeOfService                = $20;
  377.     precedence                    = $10;
  378.  
  379. { TOSFlags }
  380.     lowDelay                    = $01;
  381.     throughPut                    = $02;
  382.     reliability                    = $04;
  383.  
  384.  
  385. TYPE
  386.     TCPCreatePB = RECORD
  387.         rcvBuff:                Ptr;
  388.         rcvBuffLen:                LONGINT;
  389.         notifyProc:                TCPNotifyUPP;
  390.         userDataPtr:            Ptr;
  391.     END;
  392.  
  393.     TCPOpenPB = RECORD
  394.         ulpTimeoutValue:        SInt8;
  395.         ulpTimeoutAction:        SInt8;
  396.         validityFlags:            SInt8;
  397.         commandTimeoutValue:    SInt8;
  398.         remoteHost:                ip_addr;
  399.         remotePort:                tcp_port;
  400.         localHost:                ip_addr;
  401.         localPort:                tcp_port;
  402.         tosFlags:                SInt8;
  403.         precedence:                SInt8;
  404.         dontFrag:                BOOLEAN;
  405.         timeToLive:                SInt8;
  406.         security:                SInt8;
  407.         optionCnt:                SInt8;
  408.         options:                ARRAY [0..39] OF SInt8;
  409.         userDataPtr:            Ptr;
  410.     END;
  411.  
  412.     TCPSendPB = RECORD
  413.         ulpTimeoutValue:        SInt8;
  414.         ulpTimeoutAction:        SInt8;
  415.         validityFlags:            SInt8;
  416.         pushFlag:                BOOLEAN;
  417.         urgentFlag:                BOOLEAN;
  418.         filler:                    SInt8;                                    { Filler for proper byte alignment     }
  419.         wdsPtr:                    Ptr;
  420.         sendFree:                LONGINT;
  421.         sendLength:                INTEGER;
  422.         userDataPtr:            Ptr;
  423.     END;
  424.  
  425. { for receive and return rcv buff calls }
  426. {   Note: the filler in the following structure is in a different location than }
  427. {         that specified in the Programmer's Guide.  }
  428.     TCPReceivePB = RECORD
  429.         commandTimeoutValue:    SInt8;
  430.         markFlag:                BOOLEAN;
  431.         urgentFlag:                BOOLEAN;
  432.         filler:                    SInt8;                                    { Filler for proper byte alignment  }
  433.         rcvBuff:                Ptr;
  434.         rcvBuffLen:                INTEGER;
  435.         rdsPtr:                    Ptr;
  436.         rdsLength:                INTEGER;
  437.         secondTimeStamp:        INTEGER;
  438.         userDataPtr:            Ptr;
  439.     END;
  440.  
  441.     TCPClosePB = RECORD
  442.         ulpTimeoutValue:        SInt8;
  443.         ulpTimeoutAction:        SInt8;
  444.         validityFlags:            SInt8;
  445.         filler:                    SInt8;                                    { Filler for proper byte alignment     }
  446.         userDataPtr:            Ptr;
  447.     END;
  448.  
  449.     HistoBucket = RECORD
  450.         value:                    INTEGER;
  451.         counter:                LONGINT;
  452.     END;
  453.  
  454.  
  455. CONST
  456.     NumOfHistoBuckets            = 7;
  457.  
  458.  
  459. TYPE
  460.     TCPConnectionStats = RECORD
  461.         dataPktsRcvd:            LONGINT;
  462.         dataPktsSent:            LONGINT;
  463.         dataPktsResent:            LONGINT;
  464.         bytesRcvd:                LONGINT;
  465.         bytesRcvdDup:            LONGINT;
  466.         bytesRcvdPastWindow:    LONGINT;
  467.         bytesSent:                LONGINT;
  468.         bytesResent:            LONGINT;
  469.         numHistoBuckets:        INTEGER;
  470.         sentSizeHisto:            ARRAY [0..6] OF HistoBucket;
  471.         lastRTT:                INTEGER;
  472.         tmrSRTT:                INTEGER;
  473.         rttVariance:            INTEGER;
  474.         tmrRTO:                    INTEGER;
  475.         sendTries:                SInt8;
  476.         sourchQuenchRcvd:        SInt8;
  477.     END;
  478.  
  479.     TCPStatusPB = RECORD
  480.         ulpTimeoutValue:        SInt8;
  481.         ulpTimeoutAction:        SInt8;
  482.         unused:                    LONGINT;
  483.         remoteHost:                ip_addr;
  484.         remotePort:                tcp_port;
  485.         localHost:                ip_addr;
  486.         localPort:                tcp_port;
  487.         tosFlags:                SInt8;
  488.         precedence:                SInt8;
  489.         connectionState:        SInt8;
  490.         filler:                    SInt8;                                    { Filler for proper byte alignment     }
  491.         sendWindow:                INTEGER;
  492.         rcvWindow:                INTEGER;
  493.         amtUnackedData:            INTEGER;
  494.         amtUnreadData:            INTEGER;
  495.         securityLevelPtr:        Ptr;
  496.         sendUnacked:            LONGINT;
  497.         sendNext:                LONGINT;
  498.         congestionWindow:        LONGINT;
  499.         rcvNext:                LONGINT;
  500.         srtt:                    LONGINT;
  501.         lastRTT:                LONGINT;
  502.         sendMaxSegSize:            LONGINT;
  503.         connStatPtr:            ^TCPConnectionStats;
  504.         userDataPtr:            Ptr;
  505.     END;
  506.  
  507.     TCPAbortPB = RECORD
  508.         userDataPtr:            Ptr;
  509.     END;
  510.  
  511.     TCPParam = RECORD
  512.         tcpRtoA:                LONGINT;
  513.         tcpRtoMin:                LONGINT;
  514.         tcpRtoMax:                LONGINT;
  515.         tcpMaxSegSize:            LONGINT;
  516.         tcpMaxConn:                LONGINT;
  517.         tcpMaxWindow:            LONGINT;
  518.     END;
  519.  
  520.     TCPStats = RECORD
  521.         tcpConnAttempts:        LONGINT;
  522.         tcpConnOpened:            LONGINT;
  523.         tcpConnAccepted:        LONGINT;
  524.         tcpConnClosed:            LONGINT;
  525.         tcpConnAborted:            LONGINT;
  526.         tcpOctetsIn:            LONGINT;
  527.         tcpOctetsOut:            LONGINT;
  528.         tcpOctetsInDup:            LONGINT;
  529.         tcpOctetsRetrans:        LONGINT;
  530.         tcpInputPkts:            LONGINT;
  531.         tcpOutputPkts:            LONGINT;
  532.         tcpDupPkts:                LONGINT;
  533.         tcpRetransPkts:            LONGINT;
  534.     END;
  535.  
  536.     StreamPPtr = ^StreamPtr;
  537.  
  538.     TCPGlobalInfoPB = RECORD
  539.         tcpParamPtr:            ^TCPParam;
  540.         tcpStatsPtr:            ^TCPStats;
  541.         tcpCDBTable:            ARRAY [0..0] OF StreamPPtr;
  542.         userDataPtr:            Ptr;
  543.         maxTCPConnections:        INTEGER;
  544.     END;
  545.  
  546.     TCPIOCompletionProcPtr = ProcPtr;  { PROCEDURE TCPIOCompletion(VAR iopb: TCPiopb); }
  547.     TCPIOCompletionUPP = UniversalProcPtr;
  548.  
  549.     TCPiopb = RECORD
  550.         fill12:                    ARRAY [0..11] OF SInt8;
  551.         ioCompletion:            TCPIOCompletionUPP;
  552.         ioResult:                INTEGER;
  553.         ioNamePtr:                Ptr;
  554.         ioVRefNum:                INTEGER;
  555.         ioCRefNum:                INTEGER;
  556.         csCode:                    INTEGER;
  557.         tcpStream:                StreamPtr;
  558.         CASE INTEGER OF
  559.         0: (
  560.             create:                        TCPCreatePB;
  561.            );
  562.         1: (
  563.             open:                        TCPOpenPB;
  564.            );
  565.         2: (
  566.             send:                        TCPSendPB;
  567.            );
  568.         3: (
  569.             receive:                    TCPReceivePB;
  570.            );
  571.         4: (
  572.             close:                        TCPClosePB;
  573.            );
  574.         5: (
  575.             abort:                        TCPAbortPB;
  576.            );
  577.         6: (
  578.             status:                        TCPStatusPB;
  579.            );
  580.         7: (
  581.             globalInfo:                    TCPGlobalInfoPB;
  582.            );
  583.  
  584.     END;
  585.  
  586.  
  587. CONST
  588.     UDPCreate                    = 20;
  589.     UDPRead                        = 21;
  590.     UDPBfrReturn                = 22;
  591.     UDPWrite                    = 23;
  592.     UDPRelease                    = 24;
  593.     UDPMaxMTUSize                = 25;
  594.     UDPStatus                    = 26;
  595.     UDPMultiCreate                = 27;
  596.     UDPMultiSend                = 28;
  597.     UDPMultiRead                = 29;
  598.     UDPCtlMax                    = 29;
  599.  
  600.     UDPDataArrival                = 1;
  601.     UDPICMPReceived                = 2;
  602.     lastUDPEvent                = 32767;
  603.  
  604.     
  605. TYPE
  606.     UDPEventCode = INTEGER;
  607.  
  608.     UDPNotifyProcPtr = ProcPtr;  { PROCEDURE UDPNotify(udpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; VAR icmpMsg: ICMPReport); }
  609.     UDPNotifyUPP = UniversalProcPtr;
  610.  
  611.     udp_port = INTEGER;
  612.  
  613. { for create and release calls }
  614.     UDPCreatePB = RECORD
  615.         rcvBuff:                Ptr;
  616.         rcvBuffLen:                LONGINT;
  617.         notifyProc:                UDPNotifyUPP;
  618.         localPort:                INTEGER;
  619.         userDataPtr:            Ptr;
  620.         endingPort:                udp_port;
  621.     END;
  622.  
  623.     UDPSendPB = RECORD
  624.         reserved:                INTEGER;
  625.         remoteHost:                ip_addr;
  626.         remotePort:                udp_port;
  627.         wdsPtr:                    Ptr;
  628.         checkSum:                BOOLEAN;
  629.         filler:                    SInt8;                                    { Filler for proper byte alignment     }
  630.         sendLength:                INTEGER;
  631.         userDataPtr:            Ptr;
  632.         localPort:                udp_port;
  633.     END;
  634.  
  635. { for receive and buffer return calls }
  636.     UDPReceivePB = RECORD
  637.         timeOut:                INTEGER;
  638.         remoteHost:                ip_addr;
  639.         remotePort:                udp_port;
  640.         rcvBuff:                Ptr;
  641.         rcvBuffLen:                INTEGER;
  642.         secondTimeStamp:        INTEGER;
  643.         userDataPtr:            Ptr;
  644.         destHost:                ip_addr;                                { only for use with multi rcv }
  645.         destPort:                udp_port;                                { only for use with multi rcv }
  646.     END;
  647.  
  648.     UDPMTUPB = RECORD
  649.         mtuSize:                INTEGER;
  650.         remoteHost:                ip_addr;
  651.         userDataPtr:            Ptr;
  652.     END;
  653.  
  654.     UDPIOCompletionProcPtr = ProcPtr;  { PROCEDURE UDPIOCompletion(VAR iopb: UDPiopb); }
  655.     UDPIOCompletionUPP = UniversalProcPtr;
  656.  
  657.     UDPiopb = RECORD
  658.         fill12:                    ARRAY [0..11] OF SInt8;
  659.         ioCompletion:            UDPIOCompletionUPP;
  660.         ioResult:                INTEGER;
  661.         ioNamePtr:                Ptr;
  662.         ioVRefNum:                INTEGER;
  663.         ioCRefNum:                INTEGER;
  664.         csCode:                    INTEGER;
  665.         udpStream:                StreamPtr;
  666.         CASE INTEGER OF
  667.         0: (
  668.             create:                        UDPCreatePB;
  669.            );
  670.         1: (
  671.             send:                        UDPSendPB;
  672.            );
  673.         2: (
  674.             receive:                    UDPReceivePB;
  675.            );
  676.         3: (
  677.             mtu:                        UDPMTUPB;
  678.            );
  679.  
  680.     END;
  681.  
  682.  
  683. CONST
  684.     uppGetIPIOCompletionProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  685.     uppIPIOCompletionProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  686.     uppICMPEchoNotifyProcInfo = $000000C0; { PROCEDURE (4 byte param); }
  687.     uppTCPNotifyProcInfo = $0000EEC0; { PROCEDURE (4 byte param, 2 byte param, 4 byte param, 2 byte param, 4 byte param); }
  688.     uppTCPIOCompletionProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  689.     uppUDPNotifyProcInfo = $00003EC0; { PROCEDURE (4 byte param, 2 byte param, 4 byte param, 4 byte param); }
  690.     uppUDPIOCompletionProcInfo = $000000C1; { PROCEDURE (4 byte param); }
  691.  
  692. FUNCTION NewGetIPIOCompletionProc(userRoutine: GetIPIOCompletionProcPtr): GetIPIOCompletionUPP;
  693.     {$IFC NOT GENERATINGCFM }
  694.     INLINE $2E9F;
  695.     {$ENDC}
  696.  
  697. FUNCTION NewIPIOCompletionProc(userRoutine: IPIOCompletionProcPtr): IPIOCompletionUPP;
  698.     {$IFC NOT GENERATINGCFM }
  699.     INLINE $2E9F;
  700.     {$ENDC}
  701.  
  702. FUNCTION NewICMPEchoNotifyProc(userRoutine: ICMPEchoNotifyProcPtr): ICMPEchoNotifyUPP;
  703.     {$IFC NOT GENERATINGCFM }
  704.     INLINE $2E9F;
  705.     {$ENDC}
  706.  
  707. FUNCTION NewTCPNotifyProc(userRoutine: TCPNotifyProcPtr): TCPNotifyUPP;
  708.     {$IFC NOT GENERATINGCFM }
  709.     INLINE $2E9F;
  710.     {$ENDC}
  711.  
  712. FUNCTION NewTCPIOCompletionProc(userRoutine: TCPIOCompletionProcPtr): TCPIOCompletionUPP;
  713.     {$IFC NOT GENERATINGCFM }
  714.     INLINE $2E9F;
  715.     {$ENDC}
  716.  
  717. FUNCTION NewUDPNotifyProc(userRoutine: UDPNotifyProcPtr): UDPNotifyUPP;
  718.     {$IFC NOT GENERATINGCFM }
  719.     INLINE $2E9F;
  720.     {$ENDC}
  721.  
  722. FUNCTION NewUDPIOCompletionProc(userRoutine: UDPIOCompletionProcPtr): UDPIOCompletionUPP;
  723.     {$IFC NOT GENERATINGCFM }
  724.     INLINE $2E9F;
  725.     {$ENDC}
  726.  
  727. PROCEDURE CallGetIPIOCompletionProc(VAR iopb: GetAddrParamBlock; userRoutine: GetIPIOCompletionUPP);
  728.     {$IFC NOT GENERATINGCFM}
  729.     INLINE $205F, $4E90;
  730.     {$ENDC}
  731.  
  732. PROCEDURE CallIPIOCompletionProc(VAR iopb: ICMPParamBlock; userRoutine: IPIOCompletionUPP);
  733.     {$IFC NOT GENERATINGCFM}
  734.     INLINE $205F, $4E90;
  735.     {$ENDC}
  736.  
  737. PROCEDURE CallICMPEchoNotifyProc(VAR iopb: ICMPParamBlock; userRoutine: ICMPEchoNotifyUPP);
  738.     {$IFC NOT GENERATINGCFM}
  739.     INLINE $205F, $4E90;
  740.     {$ENDC}
  741.  
  742. PROCEDURE CallTCPNotifyProc(tcpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; terminReason: INTEGER; VAR icmpMsg: ICMPReport; userRoutine: TCPNotifyUPP);
  743.     {$IFC NOT GENERATINGCFM}
  744.     INLINE $205F, $4E90;
  745.     {$ENDC}
  746.  
  747. PROCEDURE CallTCPIOCompletionProc(VAR iopb: TCPiopb; userRoutine: TCPIOCompletionUPP);
  748.     {$IFC NOT GENERATINGCFM}
  749.     INLINE $205F, $4E90;
  750.     {$ENDC}
  751.  
  752. PROCEDURE CallUDPNotifyProc(udpStream: StreamPtr; eventCode: INTEGER; userDataPtr: Ptr; VAR icmpMsg: ICMPReport; userRoutine: UDPNotifyUPP);
  753.     {$IFC NOT GENERATINGCFM}
  754.     INLINE $205F, $4E90;
  755.     {$ENDC}
  756.  
  757. PROCEDURE CallUDPIOCompletionProc(VAR iopb: UDPiopb; userRoutine: UDPIOCompletionUPP);
  758.     {$IFC NOT GENERATINGCFM}
  759.     INLINE $205F, $4E90;
  760.     {$ENDC}
  761.  
  762. { $ALIGN RESET}
  763. { $POP}
  764.  
  765. {$ENDC} {__MACTCP__}
  766.  
  767.  IMPLEMENTATION
  768.  END.
  769.  
  770.